<div class="info-header">
    <div class="layui-row">
        <div class="layui-col-xs3">
            <label class="layui-form-label">采购单号</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.purchase_sn}" readonly class="layui-input copy-text">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">供应商单号</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.producer_sn}" readonly class="layui-input copy-text">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">供应商</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.producer_name}" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">采购人</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.buyer.nickname}" readonly class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <label class="layui-form-label">下单时间</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.business_date}" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">调入仓库</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.warehouse.name}" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">收货人</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.recv?$purchase.recv.nickname:''}" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">收货时间</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.recv_date}" readonly class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-row">
        <div class="layui-col-xs3">
            <label class="layui-form-label">收货地址</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.address}" readonly class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">采购单备注</label>
            <div class="layui-input-block">
                <input type="text" value="{$purchase.remark}" readonly class="layui-input">
            </div>
        </div>
    </div>
</div>
<form action="{:url('/pur/exchange/add')}" method="post" class="layui-form">
    <input type="hidden" name="purchase_id" value="{$purchase.purchase_id}"/>
<div class="info-body">
    <div class="layui-row">
        <div class="layui-col-xs3">
            <label class="layui-form-label">收款账号</label>
            <div class="layui-input-block">
                <select name="bank_id">
                    {foreach $banks as $bank}
                    <option value="{$bank.bank_id}">{$bank.name_acc}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">应收款日期</label>
            <div class="layui-input-block">
                <input type="text" name="cash_date" value="{:date('Y-m-d')}" id="cash-date" class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">物流商</label>
            <div class="layui-input-block">
                <select name="express_id" lay-search>
                    <option value="">请选择</option>
                    {foreach $express as $e}
                    <option value="{$e.express_id}">{$e.logistics_name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label">付费方式</label>
            <div class="layui-input-block">
                <select name="pay_type" lay-search>
                    <option value="">请选择</option>
                    {foreach $pay_type as $k=>$v}
                    <option value="{$k}">{$v}</option>
                    {/foreach}
                </select>
            </div>
        </div>
    </div>
    <div class="layui-row" style="margin-top: 30px;">
        <div class="layui-col-xs3">
            <label class="layui-form-label">物流费用</label>
            <div class="layui-input-block">
                <input type="number" name="logistics_price" value="0" class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label ">追踪号</label>
            <div class="layui-input-block">
                <input type="text" name="track_num" class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label ">备注</label>
            <div class="layui-input-block">
                <input type="text" name="remark" class="layui-input">
            </div>
        </div>
        <div class="layui-col-xs3">
            <label class="layui-form-label ">需要审批</label>
            <div class="layui-input-block">
                <input type="checkbox" name="is_check" value="1" checked lay-skin="switch">
            </div>
        </div>
    </div>
</div>
<div class="info-body">
    <div class="layui-row" style="margin-top: 30px;">
        <h2>换货商品详情</h2>
        <table class="layui-table">
            <thead>
            <tr>
                <th>图片</th>
                <th>名称</th>
                <th>SKU</th>
                <th>采购数量</th>
                <th>单位</th>
                <th>换货数量</th>
                <th>备注</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $purchase->info as $info}
            <tr>
                <input type="hidden" name="sku[]" value="{$info.sku}"/>
                <td class="text-center" width="100"><img width="100" src="{$info.image_url}"></td>
                <td>{$info.name_ch}</td>
                <td class="text-center">{$info.sku}</td>
                <td class="text-center">{$info.qty}</td>
                <td class="text-center">{$info.unit}</td>
                <td><input type="number" name="qty[]" value="" class="layui-input"></td>
                <td><input type="text" name="info_remark[]" class="layui-input"></td>
                <td><a class="layui-btn layui-btn-sm layui-bg-red remove-tr-btn">删除</a></td>
            </tr>
            {/foreach}
            </tbody>
        </table>
    </div>
</div>
</form>
{block name="script"}
<script type="text/javascript">
    layui.use(['laydate'], function()
    {
        layui.laydate.render({
            elem: "#cash-date"
            ,min: 0
        });
    });
</script>
{/block}